<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>-用户欢迎</title>

    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet">

    <style type="text/css">
        .left {
            float: left;
        }

        .right {
            float: right;
        }
    </style>
</head>
<body>

<div class="middle-box text-center loginscreen   animated fadeInDown">
    <div>
        <div>

            <h1 class="logo-name"></h1>
            <img class="logo-name" src="img/logoh.png" height="100px" width="100px"/>
        </div>
        <br/>
        <h3>预约挂号</h3>
        <br/>
        <form class="m-t" role="form" action="login.html" style="text-align: left;">

            <div class="form-group">
                <a style="font-size: 15px; color: black;">科室</a><a style="color: red;">*</a>
                <div class="form-group">
                    <div class="form-group">
                        <select class="form-control" id="room">
                            <option>请选择您要预约的科室</option>
                            <option value="儿科">儿科</option>
                            <option value="妇科">妇科</option>
                            <option value="男科">男科</option>
                            <option value="外科">外科</option>
                            <option value="内科">内科</option>
                            <option value="五官科">五官科</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <a style="font-size: 15px; color: black;">问题描述</a><a style="color: red;">*</a>
                <textarea style="height: 200px;" type="text" id="question" class="form-control" placeholder="请较详细的描述您的症状"
                          required=""></textarea>
                <a style="color: red;">*</a><a style="font-size: 12px; color: grey;">注意：预约成功后请尽快到院联系医生</a>
            </div>
            <br/><br/>
            <button type="button" onclick="addAppointment()" class="btn btn-primary block full-width m-b">提 交</button>

        </form>
    </div>
</div>

</body>
<script src="js/jquery.min.js?v=2.1.4"></script>
<script src="js/bootstrap.min.js?v=3.3.6"></script>
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="js/plugins/layer/layer.min.js"></script>
<script src="js/index.js"></script>

<script type="application/javascript">

    function addAppointment(){
        $.ajax({
            async: true,
            type: "post",
            url: "/addAppointment",
            data: JSON.stringify(getQueryData()),
            contentType: 'application/json',
            dataType: "text",
            success: function (data) {
                var result = JSON.parse(data);
                console.log(result);
                if (result.SUCCESS) {
                    alert(result.RESULT);
                } else {
                    alert(result.RESULT);
                }
            },
            error: function (data) {
                alert("请求失败");
            }
        });

    }


    function getQueryData() {
        var dto = {};
        if (!ifEmpty($("#room").val())) {
            dto["room"] = $("#room").val().trim();
        }
        if (!ifEmpty($("#question").val())) {
            dto["question"] = $("#question").val().trim();
        }
        return dto;
    }


</script>


</html>
